import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';

export default async function a002(fd: IFeidaoAiBrowserComponent, args: { currentTarget: HTMLDivElement }) {
	// tabber
	const currentTargetActive = args.currentTarget.classList.contains('is-active');
	const enableRule = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-node="a001"]');
	const disableRule = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-node="a002"]');
	const normalList = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-id="a001"]');
	const delList = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-id="a002"]');
	if (!currentTargetActive) {
		const enableRuleFlag = enableRule.classList.contains('is-active');
		const disableRuleFlag = disableRule.classList.contains('is-active');
		if (enableRuleFlag) {
			enableRule.classList.remove('is-active');
			disableRule.classList.add('is-active');
			normalList.classList.add('display-n');
			delList.classList.remove('display-n');
		} else if (disableRuleFlag) {
			enableRule.classList.add('is-active');
			disableRule.classList.remove('is-active');
			normalList.classList.remove('display-n');
			delList.classList.add('display-n');
		}
	}
}
